#include<iostream>
using namespace std;
#define N 1000000
int arr[N];
int n,k;
int kx(int a[],int k,int l,int r){
  if(l==r)return a[r];
  int i=l-1,j=r+1,x=a[l+r>>1];
  while(i<j){
    do i++;while(a[i]<x);
    do j--;while(a[j]>x);
    if(i<j)swap(a[i],a[j]);
  }
  int s=j-l+1;
  if(k<=s)return kx(a,k,l,j);
   return kx(a,k-s,j+1,r);
}
int main(){

  scanf("%d%d",&n,&k);
  for(int i=0;i<n;i++)scanf("%d",&arr[i]);
  int kk=kx(arr,k,0,n-1);
  printf("%d",kk);
}